import 'package:date_format/date_format.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:s_mankey/config/router_config.dart';
import 'package:s_mankey/config/storage_manager.dart';
import 'package:s_mankey/ui/widget/show_toast.dart';
import 'package:s_mankey/view_model/login_vmodel.dart';

class UnLoginNav {

  BuildContext context;
  UnLoginNav(this.context);

  //未登录跳转.
  unLogin(){
    var model = Provider.of<LoginVModel>(context,listen: false);
//    debugPrint('是否登录${model.isLogin}');
//    debugPrint('是否登录${model.userModel?.accessToken}');
    if(!model.isLogin){
//      Toast.toast(context, msg: "请先登录 ");
      Future.delayed(Duration(milliseconds: 20), (){
        Navigator.pushReplacementNamed(context, RouterName.loginPage);
      });
    }
  }
}